package cn.com.dashihui.web.service;
import java.util.ArrayList;
import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;

import cn.com.dashihui.web.dao.WxHomeWindow;
public class WxHomeWindowService {

	public boolean addArticle(WxHomeWindow newObject) {
		return newObject.save();
	}

	public boolean delWxHomeWindow(int id) {
		return WxHomeWindow.me().deleteById(id);
	}

	public boolean editWxHomeWindow(WxHomeWindow object) {
		return object.update();
	}

	public WxHomeWindow findById(int id) {
		return WxHomeWindow.me().findFirst("SELECT * FROM t_bus_home_window WHERE id=?", id);
	}

	public Page<WxHomeWindow> findByPage(int pageNum, int pageSize) {
		StringBuffer sBuffer = new StringBuffer();
		List<Object> params = new ArrayList<Object>();
		sBuffer.append("FROM t_bus_home_window A  ORDER BY A.createDate DESC");
		// 查询出符合条件的列表
		return WxHomeWindow.me().paginate(pageNum, pageSize,
				"SELECT A.*", sBuffer.toString(),
				params.toArray());
	}
	public boolean Delete(int id) {
		Db.deleteById("t_bus_home_window", id);
		return true;

	}
}
